package com.peter.design.pattern.factory.simplefactory;

/**
 * @Auther: 肖冬
 * @Date: 2020/7/22 19:54
 * @Description: 产品工厂
 */
public class ProductFactory {
    private ProductFactory(){}

    public static IProduct createProduct(String productName){
        if (productName == null) {
            return null;
        }
        if (productName.equals("A")) {
            return new ProductA();
        }else if (productName.equals("B")) {
            return new ProductB();
        }else {
            return null;
        }
    }
}
